// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.sandbox;

import zombie.core.math.PZMath;
import zombie.scripting.ScriptParser;
import zombie.util.StringUtils;

public class CustomSandboxOption {
    public final String m_id;
    public String m_page;
    public String m_translation;

    CustomSandboxOption(String string) {
        this.m_id = string;
    }

    static double getValueDouble(ScriptParser.Block block, String string, double _double) {
        ScriptParser.Value value = block.getValue(string);
        return value == null ? _double : PZMath.tryParseDouble(value.getValue().trim(), _double);
    }

    static float getValueFloat(ScriptParser.Block block, String string, float _float) {
        ScriptParser.Value value = block.getValue(string);
        return value == null ? _float : PZMath.tryParseFloat(value.getValue().trim(), _float);
    }

    static int getValueInt(ScriptParser.Block block, String string, int _int) {
        ScriptParser.Value value = block.getValue(string);
        return value == null ? _int : PZMath.tryParseInt(value.getValue().trim(), _int);
    }

    boolean parseCommon(ScriptParser.Block block) {
        ScriptParser.Value value0 = block.getValue("page");
        if (value0 != null) {
            this.m_page = StringUtils.discardNullOrWhitespace(value0.getValue().trim());
        }

        ScriptParser.Value value1 = block.getValue("translation");
        if (value1 != null) {
            this.m_translation = StringUtils.discardNullOrWhitespace(value1.getValue().trim());
        }

        return true;
    }
}
